home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-20 | 4.3 KB | 151 lines | [TEXT/MPS ] |
- // Copyright © 1992-1993 Emergent Behavior. All rights reserved.
-
- //=================================================================
- #ifndef _TBENCHMARKVIEW_
- #include "TBenchMarkView.h"
- #endif
-
- #ifndef _TBENCHMARKDOCUMENT_
- #include "TBenchMarkDocument.h"
- #endif
-
- //=================================================================
- TBenchMarkView::TBenchMarkView(Point size, TDocument* theDoc)
- : TBufferedView(size, theDoc)
- {
-
-
- }
-
- //-----------------------------------------------------------------
- TBenchMarkView::~TBenchMarkView()
- {
- }
-
- //-----------------------------------------------------------------
- void
- TBenchMarkView::DisplayWaitPict()
- {
- const Point kCorner = {80,80};
- short kWaitPictID;
- if ( TComputer::HasColorQuickDraw() ) // if the computer doesn't have color QuickDraw then
- kWaitPictID = 1002; // we will use a black and white pict
- else
- kWaitPictID = 1004;
- TPicture picture( kWaitPictID, kCorner, this);
- fItemList.AdoptItem( &picture );
- this->InvalidateAll();
- this->DrawContents();
- }
- //-----------------------------------------------------------------
- void
- TBenchMarkView::Draw()
- {
- const short kNumDigits = 2;
- TBenchMarkDocument* theDoc = this->GetBenchMarkDocument();
- PenNormal();
- if ( theDoc->HardwareTested() )
- this->SetHardwareDisplay();
- else
- this->UninitializedHardwareDisplay();
- fAdditionTimeText->SetText( theDoc->GetAdditionSpeed()/ (extended)kTicksInSecond, kNumDigits );
- fDivisionTimeText->SetText( theDoc->GetDivisionSpeed()/ (extended)kTicksInSecond, kNumDigits );
- fRandomNumberTimeText->SetText( theDoc->GetRandomNumberSpeed()/ (extended)kTicksInSecond, kNumDigits );
- fCompositeScoreText->SetText( (extended)theDoc->GetCompositeScore(), kNumDigits );
- }
-
-
- //-----------------------------------------------------------------
- void
- TBenchMarkView::DoMakeItems()
- {
- const short spacing = 25;
- const Point kOrigin ={0,0};
- short kBkgdResID;
- if ( TComputer::HasColorQuickDraw() ) // if the computer doesn't have color QuickDraw then
- kBkgdResID = 1001; // we will use a black and white pict
- else
- kBkgdResID = 1003;
- fItemList.AdoptItem( new TPicture( kBkgdResID, kOrigin, this) );
- Rect textRect = { 55,205, 75, 260 };
-
- fHasMathChipText = new TText( textRect, this);
- fItemList.AdoptItem( fHasMathChipText );
-
- textRect.top += spacing;
- textRect.bottom += spacing;
- fHas32BitQDText = new TText( textRect, this);
- fItemList.AdoptItem( fHas32BitQDText );
-
- textRect.top += spacing;
- textRect.bottom += spacing;
- fUsingSystem7Text = new TText( textRect, this);
- fItemList.AdoptItem( fUsingSystem7Text );
-
- textRect.top += spacing;
- textRect.bottom += spacing;
- fHasColorQDText = new TText( textRect, this);
- fItemList.AdoptItem( fHasColorQDText );
-
- Rect textRect2 = { 180,185, 200, 230 };
- fAdditionTimeText = new TText( textRect2, this);
- fItemList.AdoptItem( fAdditionTimeText );
-
- textRect2.top += spacing;
- textRect2.bottom += spacing;
- fDivisionTimeText = new TText( textRect2, this);
- fItemList.AdoptItem( fDivisionTimeText );
-
- textRect2.top += spacing;
- textRect2.bottom += spacing;
- fRandomNumberTimeText = new TText( textRect2, this);
- fItemList.AdoptItem( fRandomNumberTimeText );
-
- textRect2.top += spacing;
- textRect2.bottom += spacing;
- fCompositeScoreText = new TText( textRect2, this);
- fItemList.AdoptItem( fCompositeScoreText );
-
- }
-
- //-----------------------------------------------------------------
- void
- TBenchMarkView::SetHardwareDisplay()
- {
- if ( this->GetBenchMarkDocument()->HasMathChip() )
- fHasMathChipText->SetText( "\pYes" );
- else
- fHasMathChipText->SetText( "\pNo" );
-
- if ( this->GetBenchMarkDocument()->Has32BitQD() )
- fHas32BitQDText->SetText( "\pYes" );
- else
- fHas32BitQDText->SetText( "\pNo" );
-
- if ( this->GetBenchMarkDocument()->UsingSystem7() )
- fUsingSystem7Text->SetText( "\pYes" );
- else
- fUsingSystem7Text->SetText( "\pNo" );
-
- if ( this->GetBenchMarkDocument()->HasColorQD() )
- fHasColorQDText->SetText( "\pYes" );
- else
- fHasColorQDText->SetText( "\pNo" );
- }
-
- //-----------------------------------------------------------------
- void
- TBenchMarkView::UninitializedHardwareDisplay()
- {
- fHasMathChipText->SetText( "\p???" );
- fHas32BitQDText->SetText( "\p???" );
- fUsingSystem7Text->SetText( "\p???" );
- fHasColorQDText->SetText( "\p???" );
- }
-
- //-----------------------------------------------------------------
- TBenchMarkDocument*
- TBenchMarkView::GetBenchMarkDocument()
- {
- return (TBenchMarkDocument*)fDocument;
- }